In [1]:
import numpy as np
from astropy.time import Time
import datetime

The contactLocator1.txt file is produced by dslwp_occulations.script.


In [2]:
with open('/tmp/ContactLocator1.txt') as f:
    lines = f.readlines()

In [3]:
lines_split = [l.split() for l in lines[4:-5]]
time_format = '%d %b %Y %H:%M:%S.%f'
start_times = Time([datetime.datetime.strptime(' '.join(l[0:4]), time_format) for l in lines_split])
end_times = Time([datetime.datetime.strptime(' '.join(l[4:8]), time_format) for l in lines_split])

In [4]:
deltas = start_times[1:]-end_times[:-1]
cutoff = 0.2
idxs = deltas < cutoff

In [5]:
starts = Time(end_times[:-1][idxs], format='iso').value
ends = Time(start_times[1:][idxs], format='iso').value

In [6]:
for a,b in zip(starts, ends):
    print(a,'---',b)


2019-07-26 11:31:22.793 --- 2019-07-26 12:15:56.704
2019-07-27 07:53:41.841 --- 2019-07-27 08:35:54.149
2019-07-28 04:17:37.714 --- 2019-07-28 04:56:15.064